import { createRouter, createWebHashHistory, createWebHistory } from "vue-router"

	const routes = [
	    {
	        path: "/", // http://localhost:5173
	        component: () => import("@/views/baseviews.vue"),
			children: [
				{
				path: 'article/:aid',
				component: () => import("@/views/front-views/article.vue"),
				props: true
			},
			{
				path: "about",
				component: () => import("@/views/front-views/about.vue")
			},
			{
				path: "",
				component: () => import("@/views/front-views/index.vue")
			},
			{
				path: "/search",
				component: () => import("@/views/front-views/search.vue"),
				props: route => ({
					title: route.query.title,
					author: route.query.author,
					page: route.query.page
				})
			}
		]
	    },
		{
			path: "/management",
			component: () => import("@/views/management.vue"),
			children: [
				{
					path: 'articleM',
					component: () => import('@/views/management-views/articleM.vue'),
				},
				{
					path: 'picM',
					component: () => import('@/views/management-views/picM.vue'),
				},
				{
					path: '',
					component: () => import('@/views/management-views/indexM.vue')
				}
			],
			props: true
		},
		{
			path: "/test",
			component: () => import("@/views/test.vue"),
			props: true
		}
	]

	const router = createRouter({
	    history: createWebHashHistory(),
	    routes
	})

	export default router